(function( $ ){
			$.fn.DivCrapImage = function(imagesrc, iwidth, iheight) {
				var img = new Image();
				var divname=$(this).attr("id");
				var $this=$(this);
				loadingwidth=parseInt(iwidth)/4;
				loadingheight=parseInt(iheight)/4;
				//alert(divname);
				img.onload = function() {
					//alert(this.width + 'x' + this.height);
					var less=0;
					var oldwidth=parseInt(this.width);
					var oldheight=parseInt(this.height);
					var oldcondition=(oldwidth > oldheight);
					more=pare(oldcondition, this.height, this.width);
					leat=pare(oldcondition, "h", "w");
					$("#"+divname).html('<img id="'+divname+'_ii" style="position: relative; top:0px; left:0px;" src="" />');
					$("#"+divname+"_ii").attr("src", imagesrc);
					//alert($this.index());
					//$this.append('<img id="'+divname+'_'+$this.index()+'" style="position: relative; top:0px; left:0px;" src="" />')
					//$this.find("img").attr("src", imagesrc);
					//$("#"+divname+"_ii").attr("src", imagesrc);
					//alert(leat);
					if( ((this.width<=iwidth)&&(this.height==iheight))||((this.width==iwidth)&&(this.height<=iheight)) ){
						
					}else if(leat=="h"){
						radius=iheight/parseInt(this.height)*parseInt(this.width);
						if(radius<iwidth){
							radius=iwidth/parseInt(this.width)*parseInt(this.height);
							resultwidth=iwidth;
							resultheight=radius;//more
							//alert(resultwidth+":"+resultheight);
							movement=-resultheight/2+(iheight/2);
							$("#"+divname+"_ii").css({left: "0px", top: movement+"px", width: resultwidth+"px", height:resultheight+"px"});
						}else{
							resultheight=iheight;
							resultwidth=radius;//more
							movement=-resultwidth/2+(iwidth/2);
							$("#"+divname+"_ii").css({left: movement+"px", top: "0px", width: resultwidth+"px", height:resultheight+"px"});
						}
					}else if(leat=="w"){
						radius=iwidth/parseInt(this.width)*parseInt(this.height);
						if(radius<iheight){
							radius=iheight/parseInt(this.height)*parseInt(this.width);
							resultheight=iheight;
							resultwidth=radius;//more
							movement=-resultwidth/2+(iwidth/2);
							$("#"+divname+"_ii").css({left: movement+"px", top: "0px", width: resultwidth+"px", height:resultheight+"px"});
						
						}else{
							resultwidth=iwidth; //170
							resultheight=radius;//more
							//alert(resultwidth+":"+resultheight);
							movement=-resultheight/2+(iheight/2);
							$("#"+divname+"_ii").css({left: "0px", top: movement+"px", width: resultwidth+"px", height:resultheight+"px"});
						}
					}
					//this.width=resultwidth;
					//this.height=resultheight;
					
				}
				img.src = imagesrc;
				return $(this);
			};
			
})( jQuery );
function pare(v1, v2, v3){
		//LV3 return v1? v2: v3;
		if(v1){
			return v2;
		}else{
			return v3;
		}
	}